package com.yoomiito.app.model

import android.os.Parcel
import android.os.Parcelable

data class LatLng(var lat: Double, var lng: Double) : Parcelable {
    constructor(source: Parcel) : this(
            source.readDouble(),
            source.readDouble()
    )

    override fun describeContents() = 0

    override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
        writeDouble(lat)
        writeDouble(lng)
    }

    companion object {
        @JvmField
        val CREATOR: Parcelable.Creator<LatLng> = object : Parcelable.Creator<LatLng> {
            override fun createFromParcel(source: Parcel): LatLng = LatLng(source)
            override fun newArray(size: Int): Array<LatLng?> = arrayOfNulls(size)
        }
    }
}